bd58cc7aa947e678087b289d5a453fc0952e8c58,src/com/landawn/abacus/util/N.java,N,forEach,#C#number#number#R#IndexedBiFunction#BiPredicate#,21876

Before Change


     */
    public static <T, C extends Collection<? extends T>, R> R forEach(final C c, final int fromIndex, final int toIndex, final R seed,
            final IndexedBiFunction<? super T, C, R, R> accumulator, final BiPredicate<? super T, ? super R> predicate) {
        if (fromIndex <= toIndex) {
            N.checkIndex(fromIndex, toIndex, c == null ? 0 : c.size());
        } else {
            N.checkIndex(toIndex, fromIndex, c == null ? 0 : c.size());
        }

        if (N.isNullOrEmpty(c) && fromIndex == 0 && toIndex == 0) {

After Change


     */
    public static <T, C extends Collection<? extends T>, R> R forEach(final C c, int fromIndex, final int toIndex, final R seed,
            final IndexedBiFunction<R, ? super T, C, R> accumulator, final BiPredicate<? super T, ? super R> predicate) {
        N.checkIndex(fromIndex < toIndex ? fromIndex : (toIndex == -1 ? 0 : toIndex), fromIndex < toIndex ? toIndex : fromIndex, c == null ? 0 : c.size());

        if (N.isNullOrEmpty(c) && fromIndex == 0 && toIndex == 0) {
            return seed;
        }

        fromIndex = N.min(c.size() - 1, fromIndex);

        R result = seed;